package com.novunda.platform.common.utils;

import org.joda.time.DateTime;

import java.util.Date;

/**
 * 日期工具类, 继承org.apache.commons.lang3.time.DateUtils类
 *
 * @author slacrey
 * @version 2013-3-15
 */
public final class DateUtils {

    private static final String[] PARSE_PATTERNS = {"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm",
            "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm"};

    private DateUtils() {
    }

    public static String toDateString(final Date date) {
        DateTime dt = new DateTime(date);
        return dt.toString(PARSE_PATTERNS[1]);
    }

}
